package com.ikas.ai.framework.statistics.function;

import com.ikas.ai.framework.statistics.StatisticType;

import java.util.List;
import java.util.Objects;

/**
 * @Description: 综合
 * @Author: qi.yilai
 * @Date: 2023/10/27 18:10
 * @Version: 1.0.0
 **/
public class SumCalcFunction implements CalcFunction<List<? extends Number>, Long, Long, Double> {

    @Override
    public Double calculate(List<? extends Number> list) {
        return list.stream().mapToDouble(Number::doubleValue).sum();
    }

    @Override
    public Double calculate(List<? extends Number> list, Long aLong, Long aLong2) {
        throw new UnsupportedOperationException("不支持利用临时变量简化计算");
    }

    @Override
    public StatisticType type() {
        return StatisticType.SUM;
    }
}
